package com.wxy.demo.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wxy.demo.dto.UserDto;
import com.wxy.demo.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author e-Xiaoyuan.Wang
 * @since 2023-02-17
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from mybatis_user")
    List<User> findAll();

    @Select("select * from mybatis_user where user_name = #{userName}")
    List<User> findByUserName(String userName);

    @Select("select * from mybatis_user where user_name = #{userName}")
    IPage<User> findPageByUserName(Page<User> page, String userName);

    List<User> selectByIdIn(List<Integer> ids);

    @Select("select * from mybatis_user")
    List<UserDto> findUserList();
}
